<?php
class User_m extends CI_Model{
	function __construct(){
		parent::__construct();
		$this->load->database();
	}
	
	function insert($arr){
		$this->db->insert('user',$arr);
		return $this->db->insert_id();
	}
	
	function queryUserByPhone($phone){
		$res=$this->db->get_where('user',array('phone'=>$phone));
		return $res->row();
	}
	
	function query($data){
		$this->db->where($data);
		//$res=$this->db->get_where('user',$data);
		$res=$this->db->get('user');
		return $res->result();
	}
	
	function update($data,$token){
		$this->db->where('token',$token);
		$this->db->update('user',$data);
		return $this->db->affected_rows();
	}
}
